Skip to content

id(serve): is_process_alive treats EPERM as alive (#2384) - #3420

Merged
dezren39 merged 1 commit into
mainfrom
queue/5262-2384-serve-eperm
Nov 1, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/5262-2384-serve-eperm

Conversation

@dezren39

@dezren39 dezren39 commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Fixes #2384 (queue task 5262; routed by triage task 3552, CONFIRMED at main f1eac954e).

Problem: is_process_alive (pkgs/id/src/commands/serve.rs) answered kill(pid, 0) == 0 and never read errno, so EPERM — process exists, owned by another user — read as dead. get_serve_info then deleted the live serve's .iroh-serve.lock and returned None.

Fix: read the errno on a failed probe — alive iff kill(pid, 0) == 0 or errno == EPERM; ESRCH and other errnos stay dead. This mirrors the correct in-tree rule, mcpx ProcessAlive (pkgs/mcpx/internal/daemon/paths.go). The assert-nothing pid-1 test now asserts is_process_alive(1) on Unix (pid 1 exists in every PID namespace; foreign-owned under unprivileged test runs, probe-successful as root — alive either way). Own-pid/dead-pid tests and the stale-lock behaviour for genuinely dead pids are unchanged; #2142's sentinel-pid case is untouched, as pinned.

Verification: targeted cargo test --lib test_is_process_alive run on the laptop (fleet target dir) — see the task checkpoint / issue note for the result; the id CI workflow also exercises this crate.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

kill(pid, 0) failing was read as death, but EPERM means the process
exists and is owned by another user — get_serve_info then deleted the
live serve's .iroh-serve.lock and reported no serve running. Read the
errno: alive iff the probe succeeds or errno is EPERM; ESRCH and other
errnos stay dead. Mirrors mcpx ProcessAlive
(pkgs/mcpx/internal/daemon/paths.go). The assert-nothing pid-1 test now
asserts pid 1 reads as alive on Unix.
@dezren39
dezren39 merged commit 90d0b6d into main Nov 1, 2026
@dezren39
dezren39 deleted the queue/5262-2384-serve-eperm branch November 1, 2026 09:02
@dezren39
dezren39 requested a review from a team as a code owner November 1, 2026 09:30
@coderabbitai

coderabbitai Bot commented Nov 1, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 13 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f8c057ee-9555-4807-a3a4-e099a1e0c4a5
Commits

Reviewing files that changed from the base of the PR and between 574c04a and 74c1a6e.

Files selected for processing: 1
  • pkgs/id/src/commands/serve.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-01T08:31:42.334397Z 74c1a6e PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

id(serve): is_process_alive treats EPERM as dead — a live foreign-owned serve's lock is deleted by get_serve_info

1 participant